<?php
include './inc/PAGE.php';
$p = new PAGE("");

$loginOk = $p->s()->getvar("loginOk");
$username = $p->s()->getvar("username");
$type = $p->s()->getvar("type");

if($loginOk==1  && strlen($username)>0 && ($type==ADMIN || $type==LIB)) {
    $p = new PAGE("Χρηστες \"".$p->t()->canregister($type)."\"");
}else {
    header("Location: ./index.php");
}
?>
<table border="0" cellpadding="3" align="center" class="tableform">
    <thead>
        <tr>
            <th colspan="6" align="center"><a href="ze_user_librarian_add.php">Προσθήκη(+) "<?=$p->t()->canregister($type)?>"</a></th>
        </tr>
    </thead>
    <tbody>
        <tr>
            <td><b></b></td>
            <td align="center"><b>Χρήστης</b></td>
            <td align="center"><b>Όνομ/μο</b></td>
            <td align="center"><b>Λεπτομέρειες</b></td>
            <td align="center"><b>email</b></td>
            <td align="center"><b>Διαγραφή</b></td>
        </tr>

        <?php

        $sql = "SELECT id, username, name, details, email FROM users WHERE type='".$p->t()->canregister($type)."' ORDER BY id DESC";

        $array = $p->db()->resultasarray($sql);

        for($i=0;$i<count($array);$i++) {
            echo "<tr>\n";
            for($j=0;$j<count($array[0]);$j++) {
                echo "<td>".$array[$i][$j]."</td>\n";
            }
            echo "<td align=\"center\"><a href=\"ez_user_librarian_delete.php?id=".$array[$i][0]."\"><img src=\"images/rmuser.png\"/></a></td>";
            echo "</tr>\n";
        }
        ?>
    </tbody>
</table>


<?
$p->close();
?>